using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

// 继承至 BasePanel
public class MainPanel : BasePanel
{
    public Button startButton;

    public override void OnInit()
    {
        skinPath = "MainPanel";
        // layer不改也行
        layer = PanelManager.Layer.Panel;

        // DontDestroyOnLoad(gameObject);
    }

    public override void OnShow()
    {
        // 为 startButton 添加事件
        startButton = skin.transform.Find("StartButton").GetComponent<Button>();
        startButton.onClick.AddListener(OnStartClick);
    }

    public override void OnClose() { }

    private void OnStartClick()
    {
        SceneManager.LoadScene(1);
        Close();
    }
}
